

package com.hazelcast.internal.util.comparators;

import com.hazelcast.config.InMemoryFormat;

/**
 * Utility class to get comparators by {@link InMemoryFormat} of stored values.
 */
public final class ValueComparatorUtil {

    private ValueComparatorUtil() {
    }

    public static ValueComparator getValueComparatorOf(InMemoryFormat inMemoryFormat) {
        switch (inMemoryFormat) {
        case BINARY:
            return BinaryValueComparator.INSTANCE;
        case OBJECT:
            return ObjectValueComparator.INSTANCE;
        case NATIVE:
            throw new IllegalArgumentException("Native storage format is supported " + "in Hazelcast Enterprise only. Make sure you have Hazelcast " + "Enterprise JARs on your classpath !");
        default:
            throw new IllegalArgumentException("Invalid storage format: " + inMemoryFormat);

        }
    }
}
